package com.common.util;

import com.common.constant.CommonConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class CommonUtils {

    private final static Logger logger = LoggerFactory.getLogger(CommonUtils.class);
    private final Properties properties = new Properties();
    private String aa;

    public static boolean isLinux() {
        String os = System.getProperty("os.name").toLowerCase();
        logger.info("os:" + os);
        return os.indexOf("linux") >= 0;
    }

    public static Properties getProperty(){
        Properties prop = new Properties();
        InputStream inputStream = null;
        File file = new File(System.getProperty("user.dir")+ CommonConstant.PROPERTY_PATH);
        try {
            inputStream = new FileInputStream(file);
            prop.load(inputStream);
        } catch (IOException e) {
            logger.error("get property file error");
        }
        return prop;
    }
}
